using System.ComponentModel.Composition;
using OrbitOne.CRMLyncInfoDashboard.CRM.OrganizationData;

namespace OrbitOne.CRMLyncInfoDashboard.CRM.OData
{
    [Export(typeof(ICrmDataProvider))]
    public class CrmContactDataProvider: CrmDataProvider<Contact, ContactModel>, ICrmContactDataProvider
    {
        [ImportingConstructor]
        public CrmContactDataProvider(IPredicateBuilder predicateBuilder, 
             ICrmContactMetadataProvider crmMetadataProvider, 
             IClientScript clientScript) 
            : base(predicateBuilder, 
             crmMetadataProvider, 
             clientScript)
        {
        }

        protected override string[] GetSearchValues(Contact entity)
        {
            return new[]{
                           (entity.Telephone1 ?? "").CleanupNonAlphanumeric(m_phoneNumberCleanup),
                           (entity.Telephone2 ?? "").CleanupNonAlphanumeric(m_phoneNumberCleanup),
                           (entity.MobilePhone ?? "").CleanupNonAlphanumeric(m_phoneNumberCleanup),
                           (entity.EMailAddress1 ?? "")
                       };
        }

        protected override string LyncSearchFieldResourceName
        {
            get { return "ContactLyncSearchField"; }
        }

       
    }
}